// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	8/4/2013 4:39:16 PM				
// -----------------------------

#ifndef _LuaRef_h
#define _LuaRef_h

#include "LuaObject.h"

namespace ObjectLua
{

	/*
	//	Used to easily set and obtain
	//	values stored in the registry
	*/
	class OBJECTLUA LuaRef : public LuaObject
	{
	public:
		LuaRef(Lua* lpLua);
		LuaRef(Lua* lpLua, int iRef);
		LuaRef(const LuaRef& refLuaRef);
		LuaRef& operator=(const LuaRef& refLuaRef);
		virtual ~LuaRef();

		/*
		//	Obtain a registry index
		//	in case that no ref was passed
		//	along. Used to delay the ref.
		*/
		virtual void	obtainRef();
		/*
		//	Push the item referenced
		//	back onto the stack
		*/
		virtual void	push() const;
		/*
		//	Pop the item referenced
		//	from the stack and dereference it
		*/
		virtual void	pop() const;
	
	private:

		int		m_iRef;
	};

}

#endif